package com.bckj.fastboot.core.util;

import com.bckj.fastboot.core.lang.model.Result;

import java.util.function.Supplier;

public class SafeOps {

    public static <T> Result<T> runCatching(Supplier<T> supplier) {
        try {
            return new Result<>(true, supplier.get(), null);
        } catch (Throwable e) {
            return new Result<>(false, null, e);
        }
    }
}
